package com.matrix.java.chap_06;

/*
    双素数
 */
public class Ex6_29 {
    public static void main(String[] args) {
        int temp = 2;
        for (int i = 1; i < 1001; i++) {
            if (isPrime(i)) {
                if (i - temp == 2) {
                    System.out.println("(" + temp + "," + i + ")");
                }
                temp = i;
            }
        }
    }

    private static boolean isPrime(int num) {
        boolean isPrime = true;
        for (int i = 2; i < num; i++) {
            if (num % i == 0) {
                isPrime = false;
                break;
            }
        }
        return isPrime;
    }
}
